package com.ruoyi.gxjt.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.AjaxResultCopy;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.gxjt.domain.Te;
import com.ruoyi.gxjt.service.TService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * @description:
 * @author: xly
 * @date: 2022-02-15
 */
@RestController
@Api(tags = "测试api")
public class TController extends BaseController {
    @Autowired
    private TService testService;

    @GetMapping("/test")
    @ApiOperation("测试接口")
    public TableDataInfo<List<Te>> list(@Valid Te user)
    {
        startPage();
        List<Te> list = testService.selectUserList(user);
        return getDataTable(list);
    }

    @GetMapping("/testCopy")
    @ApiOperation("测试接口")
    public AjaxResultCopy<List<Te>> testCopy(Te user)
    {
        List<Te> list = testService.selectUserList(user);
        return AjaxResultCopy.success(list);
    }

    @GetMapping("/testCopy1")
    @ApiOperation("测试接口")
    public AjaxResultCopy testCopy1(Te user)
    {

        return AjaxResultCopy.error("测试错误");
    }

    @GetMapping("/testCopy2")
    @ApiOperation("测试接口")
    public AjaxResultCopy<String> testCopy2(Te user)
    {

        return AjaxResultCopy.success();
    }
}
